<table class="table table-border table-bordered table-hover table-bg">
	<thead>
		<tr class="text-c">
			<th width="25"><input type="checkbox" value="" name=""></th>
			<th>房间号</th>
			<th>合同编号</th>
			<th>客人姓名</th>
			<th>联系方式</th>
			<th>合同截止时间</th>
			<th>邀约时间</th>
			<th>邀约次数</th>
			<th>操作员</th>
			<th>备注</th>
			<th>操作</th>
		</tr>
	</thead>
	<tbody>
		<?php if(is_array($userlist) && count($userlist)){ ?>
		<?php foreach($userlist as $k=>$user){ ?>
		<tr class="text-c">
			<td><input type="checkbox" value="{$user['userid']}" name=""></td>
			<td>{$user['title']} {$user['doornumber']}</td>
			<td>{$user['contract']}</td>
			<td>{$user['nickname']}</td>
			<td>{$user['phone']}</td>
			<td><?php echo date('Y-m-d', $user['signing_etime']); ?></td>
			<td>{$user['rewentime']}</td>
			<td>{$user['rewencount']}</td>
			<td>{$user['admin_nick']}</td>
			<td class="result_{$user['userid']}">{$user['rewresult']}</td>
			<td>
				<a href="javascript:;" class="btn btn-primary radius size-S renewresult" userid="{$user['profile_id']}" phone="{$user['phone']}">备注</a>
				<a href="javascript:;" class="btn btn-warning radius size-S renew" userid="{$user['profile_id']}" phone="{$user['phone']}">邀约</a>
			</td>
		</tr>
		<?php } }else{ ?>
		<tr class="text-c">
			<td colspan="19" >暂无数据...</td>
		</tr>
		<?php } ?>
	</tbody>
</table>
<!--page-->
<include file="Common/page" />
<script>
	$(document).ready(function(){
		$(".renew").on('click', function(){
			var obj = $(this);
			$.post('renew.html', {userid: obj.attr('userid'), phone: obj.attr('phone')}, function(row){
				if(row/1){
					layer.msg('邀约成功', {icon: 1, time: 2000}, function(){
						location.reload();
					});
				}else{
					layer.msg('邀约失败', {icon: 2, time: 2000});
				}
			});
		});
		
		//反馈结果
		$(".renewresult").on('click', function(){
			var userid = $(this).attr('userid');
			var html = '<input type="text" name="result" id="result" class="input-text radius" />';
			var i = layer.open({
				title: '邀约反馈',
				content: html,
				yes: function(){
					var result = $("#result").val();
					layer.close(i);
					$.post('renew.html', {userid: userid, rewresult: result, type: 1}, function(row){
						if(row/1){
							layer.msg('设置成功', {icon: 1, time: 2000}, function(){
								$("td.result_"+ userid).html(result);
							});
						}else{
							layer.msg('设置失败', {icon: 2, time: 2000});
						}
					});
				}
			});
		});
	});
</script>